import 'package:flutter_ncsjqz_getx/generated/json/base/json_convert_content.dart';
import 'package:flutter_ncsjqz_getx/model/commodity_details_entity.dart';

CommodityDetailsEntity $CommodityDetailsEntityFromJson(Map<String, dynamic> json) {
	final CommodityDetailsEntity commodityDetailsEntity = CommodityDetailsEntity();
	final String? msg = jsonConvert.convert<String>(json['msg']);
	if (msg != null) {
		commodityDetailsEntity.msg = msg;
	}
	final int? code = jsonConvert.convert<int>(json['code']);
	if (code != null) {
		commodityDetailsEntity.code = code;
	}
	final CommodityDetailsData? data = jsonConvert.convert<CommodityDetailsData>(json['data']);
	if (data != null) {
		commodityDetailsEntity.data = data;
	}
	return commodityDetailsEntity;
}

Map<String, dynamic> $CommodityDetailsEntityToJson(CommodityDetailsEntity entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['msg'] = entity.msg;
	data['code'] = entity.code;
	data['data'] = entity.data?.toJson();
	return data;
}

CommodityDetailsData $CommodityDetailsDataFromJson(Map<String, dynamic> json) {
	final CommodityDetailsData commodityDetailsData = CommodityDetailsData();
	final int? commodityId = jsonConvert.convert<int>(json['commodityId']);
	if (commodityId != null) {
		commodityDetailsData.commodityId = commodityId;
	}
	final int? shopId = jsonConvert.convert<int>(json['shopId']);
	if (shopId != null) {
		commodityDetailsData.shopId = shopId;
	}
	final dynamic? shopPic = jsonConvert.convert<dynamic>(json['shopPic']);
	if (shopPic != null) {
		commodityDetailsData.shopPic = shopPic;
	}
	final String? commodityName = jsonConvert.convert<String>(json['commodityName']);
	if (commodityName != null) {
		commodityDetailsData.commodityName = commodityName;
	}
	final String? masterPic = jsonConvert.convert<String>(json['masterPic']);
	if (masterPic != null) {
		commodityDetailsData.masterPic = masterPic;
	}
	final int? price = jsonConvert.convert<int>(json['price']);
	if (price != null) {
		commodityDetailsData.price = price;
	}
	final int? originalPrice = jsonConvert.convert<int>(json['originalPrice']);
	if (originalPrice != null) {
		commodityDetailsData.originalPrice = originalPrice;
	}
	final String? acreage = jsonConvert.convert<String>(json['acreage']);
	if (acreage != null) {
		commodityDetailsData.acreage = acreage;
	}
	final String? title = jsonConvert.convert<String>(json['title']);
	if (title != null) {
		commodityDetailsData.title = title;
	}
	final String? commodityVideo = jsonConvert.convert<String>(json['commodityVideo']);
	if (commodityVideo != null) {
		commodityDetailsData.commodityVideo = commodityVideo;
	}
	final String? monitorLink = jsonConvert.convert<String>(json['monitorLink']);
	if (monitorLink != null) {
		commodityDetailsData.monitorLink = monitorLink;
	}

	final dynamic? shopName = jsonConvert.convert<dynamic>(json['shopName']);
	if (shopName != null) {
		commodityDetailsData.shopName = shopName;
	}
	final int? locationId = jsonConvert.convert<int>(json['locationId']);
	if (locationId != null) {
		commodityDetailsData.locationId = locationId;
	}
	final String? brief = jsonConvert.convert<String>(json['brief']);
	if (brief != null) {
		commodityDetailsData.brief = brief;
	}
	final int? status = jsonConvert.convert<int>(json['status']);
	if (status != null) {
		commodityDetailsData.status = status;
	}
	final int? categoryId = jsonConvert.convert<int>(json['categoryId']);
	if (categoryId != null) {
		commodityDetailsData.categoryId = categoryId;
	}
	final int? parentCategoryId = jsonConvert.convert<int>(json['parentCategoryId']);
	if (parentCategoryId != null) {
		commodityDetailsData.parentCategoryId = parentCategoryId;
	}
	final int? soldNum = jsonConvert.convert<int>(json['soldNum']);
	if (soldNum != null) {
		commodityDetailsData.soldNum = soldNum;
	}
	final int? totalStocks = jsonConvert.convert<int>(json['totalStocks']);
	if (totalStocks != null) {
		commodityDetailsData.totalStocks = totalStocks;
	}
	final String? content = jsonConvert.convert<String>(json['content']);
	if (content != null) {
		commodityDetailsData.content = content;
	}
	final String? deliveryAddress = jsonConvert.convert<String>(json['deliveryAddress']);
	if (deliveryAddress != null) {
		commodityDetailsData.deliveryAddress = deliveryAddress;
	}
	final CommodityDetailsDataLocation? location = jsonConvert.convert<CommodityDetailsDataLocation>(json['location']);
	if (location != null) {
		commodityDetailsData.location = location;
	}
	final dynamic? distance = jsonConvert.convert<dynamic>(json['distance']);
	if (distance != null) {
		commodityDetailsData.distance = distance;
	}
	final List<CommodityDetailsDataSkuList>? skuList = jsonConvert.convertListNotNull<CommodityDetailsDataSkuList>(json['skuList']);
	if (skuList != null) {
		commodityDetailsData.skuList = skuList;
	}
	final dynamic? masterUrls = jsonConvert.convert<dynamic>(json['masterUrls']);
	if (masterUrls != null) {
		commodityDetailsData.masterUrls = masterUrls;
	}
	final dynamic? slaveUrls = jsonConvert.convert<dynamic>(json['slaveUrls']);
	if (slaveUrls != null) {
		commodityDetailsData.slaveUrls = slaveUrls;
	}
	final List<CommodityDetailsDataProps>? props = jsonConvert.convertListNotNull<CommodityDetailsDataProps>(json['props']);
	if (props != null) {
		commodityDetailsData.props = props;
	}
	final int? amount = jsonConvert.convert<int>(json['amount']);
	if (amount != null) {
		commodityDetailsData.amount = amount;
	}
	return commodityDetailsData;
}

Map<String, dynamic> $CommodityDetailsDataToJson(CommodityDetailsData entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['monitorLink'] = entity.monitorLink;
	data['commodityId'] = entity.commodityId;
	data['shopId'] = entity.shopId;
	data['shopPic'] = entity.shopPic;
	data['commodityName'] = entity.commodityName;
	data['masterPic'] = entity.masterPic;
	data['price'] = entity.price;
	data['originalPrice'] = entity.originalPrice;
	data['acreage'] = entity.acreage;
	data['title'] = entity.title;
	data['commodityVideo'] = entity.commodityVideo;
	data['shopName'] = entity.shopName;
	data['locationId'] = entity.locationId;
	data['brief'] = entity.brief;
	data['status'] = entity.status;
	data['categoryId'] = entity.categoryId;
	data['parentCategoryId'] = entity.parentCategoryId;
	data['soldNum'] = entity.soldNum;
	data['totalStocks'] = entity.totalStocks;
	data['content'] = entity.content;
	data['deliveryAddress'] = entity.deliveryAddress;
	data['location'] = entity.location?.toJson();
	data['distance'] = entity.distance;
	data['skuList'] =  entity.skuList?.map((v) => v.toJson()).toList();
	data['masterUrls'] = entity.masterUrls;
	data['slaveUrls'] = entity.slaveUrls;
	data['props'] =  entity.props?.map((v) => v.toJson()).toList();
	data['amount'] = entity.amount;
	return data;
}

CommodityDetailsDataLocation $CommodityDetailsDataLocationFromJson(Map<String, dynamic> json) {
	final CommodityDetailsDataLocation commodityDetailsDataLocation = CommodityDetailsDataLocation();
	final double? lat = jsonConvert.convert<double>(json['lat']);
	if (lat != null) {
		commodityDetailsDataLocation.lat = lat;
	}
	final double? lon = jsonConvert.convert<double>(json['lon']);
	if (lon != null) {
		commodityDetailsDataLocation.lon = lon;
	}
	final String? geohash = jsonConvert.convert<String>(json['geohash']);
	if (geohash != null) {
		commodityDetailsDataLocation.geohash = geohash;
	}
	final bool? fragment = jsonConvert.convert<bool>(json['fragment']);
	if (fragment != null) {
		commodityDetailsDataLocation.fragment = fragment;
	}
	return commodityDetailsDataLocation;
}

Map<String, dynamic> $CommodityDetailsDataLocationToJson(CommodityDetailsDataLocation entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['lat'] = entity.lat;
	data['lon'] = entity.lon;
	data['geohash'] = entity.geohash;
	data['fragment'] = entity.fragment;
	return data;
}

CommodityDetailsDataSkuList $CommodityDetailsDataSkuListFromJson(Map<String, dynamic> json) {
	final CommodityDetailsDataSkuList commodityDetailsDataSkuList = CommodityDetailsDataSkuList();
	final int? skuId = jsonConvert.convert<int>(json['skuId']);
	if (skuId != null) {
		commodityDetailsDataSkuList.skuId = skuId;
	}
	final int? commodityId = jsonConvert.convert<int>(json['commodityId']);
	if (commodityId != null) {
		commodityDetailsDataSkuList.commodityId = commodityId;
	}
	final String? properties = jsonConvert.convert<String>(json['properties']);
	if (properties != null) {
		commodityDetailsDataSkuList.properties = properties;
	}
	final int? oriPrice = jsonConvert.convert<int>(json['oriPrice']);
	if (oriPrice != null) {
		commodityDetailsDataSkuList.oriPrice = oriPrice;
	}
	final int? actualStocks = jsonConvert.convert<int>(json['actualStocks']);
	if (actualStocks != null) {
		commodityDetailsDataSkuList.actualStocks = actualStocks;
	}
	final String? skuName = jsonConvert.convert<String>(json['skuName']);
	if (skuName != null) {
		commodityDetailsDataSkuList.skuName = skuName;
	}
	final String? skuFullName = jsonConvert.convert<String>(json['skuFullName']);
	if (skuFullName != null) {
		commodityDetailsDataSkuList.skuFullName = skuFullName;
	}
	final String? picUrl = jsonConvert.convert<String>(json['picUrl']);
	if (picUrl != null) {
		commodityDetailsDataSkuList.picUrl = picUrl;
	}
	final int? status = jsonConvert.convert<int>(json['status']);
	if (status != null) {
		commodityDetailsDataSkuList.status = status;
	}
	final int? isDelete = jsonConvert.convert<int>(json['isDelete']);
	if (isDelete != null) {
		commodityDetailsDataSkuList.isDelete = isDelete;
	}
	return commodityDetailsDataSkuList;
}

Map<String, dynamic> $CommodityDetailsDataSkuListToJson(CommodityDetailsDataSkuList entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['skuId'] = entity.skuId;
	data['commodityId'] = entity.commodityId;
	data['properties'] = entity.properties;
	data['oriPrice'] = entity.oriPrice;
	data['actualStocks'] = entity.actualStocks;
	data['skuName'] = entity.skuName;
	data['skuFullName'] = entity.skuFullName;
	data['picUrl'] = entity.picUrl;
	data['status'] = entity.status;
	data['isDelete'] = entity.isDelete;
	return data;
}

CommodityDetailsDataProps $CommodityDetailsDataPropsFromJson(Map<String, dynamic> json) {
	final CommodityDetailsDataProps commodityDetailsDataProps = CommodityDetailsDataProps();
	final int? propId = jsonConvert.convert<int>(json['propId']);
	if (propId != null) {
		commodityDetailsDataProps.propId = propId;
	}
	final int? commodityId = jsonConvert.convert<int>(json['commodityId']);
	if (commodityId != null) {
		commodityDetailsDataProps.commodityId = commodityId;
	}
	final String? propName = jsonConvert.convert<String>(json['propName']);
	if (propName != null) {
		commodityDetailsDataProps.propName = propName;
	}
	final List<CommodityDetailsDataPropsPropValues>? propValues = jsonConvert.convertListNotNull<CommodityDetailsDataPropsPropValues>(json['propValues']);
	if (propValues != null) {
		commodityDetailsDataProps.propValues = propValues;
	}
	return commodityDetailsDataProps;
}

Map<String, dynamic> $CommodityDetailsDataPropsToJson(CommodityDetailsDataProps entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['propId'] = entity.propId;
	data['commodityId'] = entity.commodityId;
	data['propName'] = entity.propName;
	data['propValues'] =  entity.propValues?.map((v) => v.toJson()).toList();
	return data;
}

CommodityDetailsDataPropsPropValues $CommodityDetailsDataPropsPropValuesFromJson(Map<String, dynamic> json) {
	final CommodityDetailsDataPropsPropValues commodityDetailsDataPropsPropValues = CommodityDetailsDataPropsPropValues();
	final int? valueId = jsonConvert.convert<int>(json['valueId']);
	if (valueId != null) {
		commodityDetailsDataPropsPropValues.valueId = valueId;
	}
	final String? propValue = jsonConvert.convert<String>(json['propValue']);
	if (propValue != null) {
		commodityDetailsDataPropsPropValues.propValue = propValue;
	}
	final int? propId = jsonConvert.convert<int>(json['propId']);
	if (propId != null) {
		commodityDetailsDataPropsPropValues.propId = propId;
	}
	final bool? select = jsonConvert.convert<bool>(json['select']);
	if (select != null) {
		commodityDetailsDataPropsPropValues.select = select;
	}
	final String? propUrl = jsonConvert.convert<String>(json['propUrl']);
	if (propUrl != null) {
		commodityDetailsDataPropsPropValues.propUrl = propUrl;
	}
	return commodityDetailsDataPropsPropValues;
}

Map<String, dynamic> $CommodityDetailsDataPropsPropValuesToJson(CommodityDetailsDataPropsPropValues entity) {
	final Map<String, dynamic> data = <String, dynamic>{};
	data['valueId'] = entity.valueId;
	data['propValue'] = entity.propValue;
	data['propId'] = entity.propId;
	data['select'] = entity.select;
	data['propUrl'] = entity.propUrl;
	return data;
}